// file STACK3.H
// Interface of a class template to define stacks
// (the example is similar to the previous versions with macros and inheritance)
#ifndef STACK3_H
#define STACK3_H

template <class T>
class Stack
{
	T	data [500];
	int	nElements;

public:
	Stack () :nElements (0){ }

	// Adds an element to the stack

	void	Push (T elem)
	{
			data [nElements] = elem;
			nElements ++;
	}

	// Gets an element from the stack

	T	Pop ()
	{
		nElements --;
		return data [nElements];
	}

	// Number of elements actually on the stack

	int	Number ()
	{
		return nElements;
	}

	// Is the stack empty?

	int		Empty ()
	{
		return (nElements == 0);
	}
};

#endif